package com.jintoufs.dao.baseinfo.impl;

import com.jintoufs.dao.MyBatisSupport;
import com.jintoufs.dao.QueryFilters;
import com.jintoufs.dao.baseinfo.TickerDAO;
import com.jintoufs.domain.baseinfo.Ticker;
import com.jintoufs.domain.ticker.TickerVO;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author xiaoemo
 */
@Repository
public class TickerDAOImpl extends MyBatisSupport<TickerDAO, Ticker> implements TickerDAO {

    @Override
    public List<Map<String, Object>> queryByParams(Map<String, Object> params) {
        return getMapper().queryByParams(params);
    }

    @Override
    public List<TickerVO> findByTicker(Map<String, Object> params) {
        return getMapper().findByTicker(params);
    }

    @Override
    public void insert(Ticker entity) {
        if(entity.getLast().doubleValue()!=0){
            getMapper().insert(entity);
        }
    }

    @Override
    public void updateByPrimaryKey(Ticker entity) {
        getMapper().updateByPrimaryKey(entity);
    }

    @Override
    public void deleteByPrimaryKey(Long id) {
        getMapper().deleteByPrimaryKey(id);
    }

    @Override
    public List<Map<String, Object>> getByFilter(QueryFilters filters) {
        return getMapper().getByFilter(filters);
    }

    @Override
    public List<Map<String, Object>> getLastestPrice(Map<String, Object> params) {
            return getMapper().getLastestPrice(params);
    }

    @Override
    public List<Map<String, Object>> queryBySite(Map<String, Object> map) {
        return getMapper().queryBySite(map);
    }

    @Override
    public void deleteByParams(Map<String, Object> params) {
        getMapper().deleteByParams(params);
    }

    @Override
    public Ticker selectByPrimaryKey(Long id) {
        return getMapper().selectByPrimaryKey(id);
    }
}
